<template>
  <section class="yw_info_desc">  
    <el-form-item label="业务类型" 
      :rules="[
        { required: true, message: '请选择业务类型', trigger: 'blur' },
      ]"
    >
      <el-select v-model="ywInfoDescForm.businessType">
        <el-option
          v-for="(item,index) in yewuType"
          :key="index"
          :label="item.name"
          :value="item.id"
        >
        </el-option>
      </el-select>
      <!-- <el-checkbox-group v-model="ywInfoDescForm.businessType" >
        <el-checkbox-button class="box_checkbox" v-for="(item,index) in yewuType" :label="item.id" :key="index">{{item.name}}</el-checkbox-button>
      </el-checkbox-group> -->
    </el-form-item>

    <el-form-item label="信息类型" 
      :rules="[
        { required: true, message: '请选择信息类型', trigger: 'blur' },
      ]"
    >
      <el-select v-model="ywInfoDescForm.infoType">
        <el-option
          v-for="(item,index) in infoType"
          :key="index"
          :label="item.name"
          :value="item.id"
        >
        </el-option>
      </el-select>
      <!-- <el-checkbox-group v-model="ywInfoDescForm.infoType">
        <el-checkbox-button class="box_checkbox" v-for="(item,index) in infoType" :label="item.id" :key="index">{{item.name}}</el-checkbox-button>
      </el-checkbox-group> -->
    </el-form-item>

    <el-form-item label="描述" placeholder="100字以内">
      <el-input type="textarea" v-model="ywInfoDescForm.describe" ></el-input>
    </el-form-item>
  </section>
</template>

<script>
    export default {
    	props:{
    		yewuType:Array,
    		infoType:Array,
    		timeSubmit :Boolean,
    		hasDataYwInfoDesc:{
    			type:Object,
    			default: function () {
			   	 	return {}
			  	}
    		},
    	},
        data() {
          return {
          		ywInfoDescForm:{
          			businessType:[],
          			infoType:[],
          			describe:'',
          		}
          };
        },
		mounted(){
			if(Object.keys(this.hasDataYwInfoDesc).length!=0){
				this.ywInfoDescForm.businessType=this.hasDataYwInfoDesc.businessType
				this.ywInfoDescForm.infoType=this.hasDataYwInfoDesc.infoType
				this.ywInfoDescForm.describe=this.hasDataYwInfoDesc.describe
			}
		},
        watch:{
        	timeSubmit(newVal){
        		this.$emit("outPutForm",this.ywInfoDescForm);
        	},
        	hasDataYwInfoDesc:{
        		handler(newVal, oldVal){
        			this.ywInfoDescForm.businessType=newVal.businessType.map((item)=>{
        				return Number(item);
        			})
					this.ywInfoDescForm.infoType=newVal.infoType.map((item)=>{
        				return Number(item);
        			})
					this.ywInfoDescForm.describe=newVal.describe
        		},
        		deep:true
        	},
        	
        }
  };
</script>

<style scoped="scoped">
    
</style>